import { getCache, setCache } from "#server/utils/context"; import { getToolById } from "../../service/tool"; export default defineWrappedResponseHandler(async (event) => { const id = getRouterParam(event, "id"); if (!id) return R.throwError(400, "Missing id", null); const cacheKey = `tool:${id}`; const cached = await getCache(cacheKey); if (cached) return R.success(cached); const tool = await getToolById(id); if (!tool) return R.throwError(404, "Tool not found", null); await setCache(cacheKey, tool, 300); return R.success(tool); });